package com.burgeon.backend.SHOP.service.util;

import org.apache.commons.io.IOUtils;
import org.springframework.core.io.ClassPathResource;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class WeChatPaykeyData {

    public static byte[] WXMyConfigUtil(String token) throws Exception {

       // String certPath = "apiclient_cert.p12";//从微信商户平台下载的安全证书存放的目录

        ClassPathResource classPathResource =
                new ClassPathResource("\\wechatKey\\"+token+"\\apiclient_cert.p12");
        InputStream certStream = classPathResource.getInputStream();
        byte[] certData = IOUtils.toByteArray(certStream);
        certStream.read(certData);
        certStream.close();

        return certData;
    }
}
